/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package core.threads.client.inGame;
import core.messages.client.creation.Msg_Role_Select;
import core.threads.client.Client_Public_Data;
import core.threads.client.Client_Public_MsgBox;

/**
 *
 * @author Invince
 */
public class T_Client_Role_Selector  extends Thread{
/*----------Attributs-------------------*/
    protected boolean stop;
    protected boolean suspend;

/*----------Public functions------------*/
    @Override
    public void run() {
        /**-----Init-----**/
        String name;
        synchronized(Client_Public_Data.semaMyInfo){
           name=Client_Public_Data.myInfo.getName();
        }
        /**-----Loop----**/
        while(!this.stop){
            if(!this.suspend){
                if(!Client_Public_MsgBox.msgBox_Client_Role_Select.isEmpty()){
                    Msg_Role_Select msgRoleSelect=Client_Public_MsgBox.msgBox_Client_Role_Select.poll();
                    Client_Public_MsgBox.msgBox_Client_Send_Msg.offer(msgRoleSelect);
                }
            }
        }
        /**----End-----**/
    }

    public void stopT(){
        synchronized(this){
            this.stop=true;
        }
    }

    public void suspendT(){
        synchronized(this){
            this.suspend=true;
        }
    }

    public void resumeT(){
        synchronized(this){
            this.suspend=false;
        }
    }
/*----------Private functions-----------*/
/*----------Constructor-----------------*/
    public T_Client_Role_Selector() {
        synchronized(this){
            this.stop=false;
            this.suspend=false;
        }
    }
/*----------Gets and sets---------------*/
}
